package com.whenjun.common;

import com.ifootbook.util.EmailUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @Auther: whenjun
 * @Date: 2023/5/22 0022 15:00
 * @Description:
 */
@Component
public class Base {

    public static String ISC_HOST;

    public static String ISC_APPKEY;

    public static String ISC_APPSECRET;

    public static String RECEIVE_MAIL;

    public static String RECEIVE_MAIL2;


    @Value("${sa-token.timeout}")
    public Integer SA_TOKEN_TIMEOUT;

    /**
     * 默认系统异常错误码
     */
    public static final int SYSTEM_RETURN_CODE = 10000;

    /**
     * 默认系统异常错误信息
     */
    public static final String SYSTEM_RETURN_MESSAGE = "System exception";

    @Value("${receive.mail}")
    public void setReceiveMail(String receiveMail) {
        RECEIVE_MAIL = receiveMail;
    }

    @Value("${receive.mail2}")
    public void setReceiveMail2(String receiveMail2) {
        RECEIVE_MAIL2 = receiveMail2;
    }

    @Value("${isc.host}")
    public void setIscHost(String iscHost) {
        ISC_HOST = iscHost;
    }

    @Value("${isc.appKey}")
    public void setIscAppkey(String iscAppkey) {
        ISC_APPKEY = iscAppkey;
    }

    @Value("${isc.appSecret}")
    public void setIscAppsecret(String iscAppsecret) {
        ISC_APPSECRET = iscAppsecret;
    }

    @Value("${email.name}")
    public void setName(String name) {
        EmailUtil.name = name;
    }

    @Value("${email.username}")
    public void setUsername(String username) {
        EmailUtil.username = username;
    }

    @Value("${email.password}")
    public void setPassword(String password) {
        EmailUtil.password = password;
    }

    @Value("${email.hostname}")
    public void setHostname(String hostname) {
        EmailUtil.hostname = hostname;
    }
}
